/**
 * 图片转base64
 * @param  {String} image    新键值
 * @param  { Fun }  callback    老键值
 */
export const imageCanvasBase64 = (image, callback) => {
  let imgs = new Image()
  imgs.crossOrigin = "Anonymous" //注意存放顺序
  imgs.src = image
  imgs.onload = function () {
      let canvass = document.createElement('canvas')
      canvass.width = imgs.width
      canvass.height = imgs.height
      let ctxImg = canvass.getContext("2d")
      ctxImg.drawImage(imgs, 0, 0, imgs.width, imgs.height)
      let img1 = new Image()
      img1.src = canvass.toDataURL("image/png")
      callback(img1.src)
  }
}